<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-eduInfo-edit" th:object="${projectInfo}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">任务书下达时间：</label>
                <div class="col-sm-8">
                    <input id="taskOrderTime" name="taskOrderTime" class="form-control" type="date" th:value="${#dates.format(projectInfo.taskOrderTime, 'yyyy-MM-dd')}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">项目编号：</label>
                <div class="col-sm-8">
                    <input id="projectId" th:field="*{projectId}" name="projectId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">项目名称：</label>
                <div class="col-sm-8">
                    <input id="projectName" th:field="*{projectName}" name="projectName" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">项目经理：</label>
                <div class="col-sm-8">
                    <input id="pmp" th:field="*{pmp}" name="pmp" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">所属处室：</label>
                <div class="col-sm-8">
                    <input id="department" th:field="*{department}" name="department" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">开始时间：</label>
                <div class="col-sm-8 form-inline select-time">
                    <input type="text" class="time-input form-control" id="startTime" placeholder="开始时间" name="startTime" th:value="${#dates.format(projectInfo.startTime, 'yyyy-MM-dd')}"/>
                    <span class="form-control text-center" style="border:0;">结束时间</span>
                    <input type="text" class="time-input form-control" id="endTime" placeholder="结束时间" name="endTime" th:value="${#dates.format(projectInfo.endTime, 'yyyy-MM-dd')}"/>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">预算下达情况：</label>
                <div class="col-sm-8">
                    <select id="budgetStatus" class="form-control m-b" th:with="type=${@dict.getType('budget_status')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}" th:field="*{budgetStatus}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">项目状态：</label>
                <div class="col-sm-8">
                    <select id="projectStatus" class="form-control m-b" th:with="type=${@dict.getType('project_status')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}" th:field="*{projectStatus}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">订单下达状态：</label>
                <div class="col-sm-8">
                    <input id="orderStatus" th:field="*{orderStatus}" name="orderStatus" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">项目类型：</label>
                <div class="col-sm-8">
                    <select id="projectType" class="form-control m-b" th:with="type=${@dict.getType('project_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}" th:field="*{projectType}"></option>
                    </select>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input id="remark" th:field="*{remark}" name="remark" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "pm/projectInfo"
		$("#form-projectInfo-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});

        function submitHandler() {
            if ($.validate.form()) {
                //$.operate.save(prefix + "/edit", $('#form-baseInfo-edit').serialize());
                edit();
            }
        }

        function edit() {
            var id = $("input[name='id']").val();
            var taskOrderTime = $("input[name='taskOrderTime']").val();
            var projectId = $("input[name='projectId']").val();
            var projectName = $("input[name='projectName']").val();
            var pmp = $("input[name='pmp']").val();
            var department = $("input[name='department']").val();
            var startTime = $("#startTime").val();
            var endTime = $("#endTime").val();
            var budgetStatus = $("#budgetStatus option:selected").val();
            var projectStatus = $("#projectStatus option:selected").val();
            var orderStatus = $("input[name='orderStatus']").val();
            var projectType = $("#projectType option:selected").val();
            var resourcePoolType = $("input[name='resourcePoolType']").val();
            var evaluationStatus = $("#evaluationStatus option:selected").val();
            var employeeType = $("#employeeType option:selected").val();
            var employeeLevel = $("#employeeLevel option:selected").val();
            var remark = $("input[name='remark']").val();
            $.ajax({
                cache : true,
                type : "POST",
                url : ctx + "pm/projectInfo/edit",
                data : {
                    "id":id,
                    "taskOrderTime":taskOrderTime,
                    "projectId":projectId,
                    "projectName":projectName,
                    "pmp": pmp,
                    "department": department,
                    "startTime":startTime,
                    "endTime":endTime,
                    "budgetStatus":budgetStatus,
                    "projectStatus":projectStatus,
                    "orderStatus":orderStatus,
                    "projectType":projectType,
                    "resourcePoolType":resourcePoolType,
                    "evaluationStatus":evaluationStatus,
                    "employeeType":employeeType,
                    "employeeLevel":employeeLevel,
                    "remark":remark
                },
                async : true,
                error : function(request) {
                    $.modal.alertError("系统错误");
                },
                success : function(data) {
                    $.operate.saveSuccess(data);
                }
            });
        }
	</script>
</body>
</html>
